import sys
sys.path.append('..\\..')
from Djoser import *



root = Tk()
f1 = Frame(root)
f1.pack()

img = DjImage(f1)
img.pack()

img.image = 'base64:R0lGODlhGAAYAIABAAAAAP///yH5BAEAAAEALAAAAAAYABgAAAI0jI+py+0PAXxATlbtTVlv03lbKE5kSZ3fWY0surxtRH5BduMuqF9eZzsAg7xZcEg0EpebAgA7'

	

def test(n):
	#test properties
	if n==0:
		img.image = 'base64:R0lGODlhGAAYAJECAP///wAAAP///wAAACH5BAEAAAIALAAAAAAYABgAAAJOlI+pixEMGwAvwjCrXZhu1mmfRDkjGZpjmGXi1VLtezgPK+e0kE6+H+IAf8QMKFYEwjpJ47H529WgShhVSmpip9Att+j9EsMGm9l2OhUAADs='
		
	if n==1: 
		img.bgcolor=(200,255,255)
		img.color = (255,0,0)
		print img.bgcolor,img.color
	elif n==2:
		img.borderstyle='raised'
		assert str(img.borderstyle)=='raised'
	elif n==3:
		img.borderwidth=4
		assert str(img.borderwidth)=='4'
	
	elif n==4:
		img.height = 10
		img.width = 10
		assert str(img.height) == '10' and str(img.width) == '10'
	elif n==5:
		img.height = 100
		img.width = 100
		img.anchor = 'e'
		assert str(img.anchor)=='e'
	
	elif n==10:
		#Tests that updates can be made without waiting to return to mainloop
		img1 = PhotoImage(format='gif',data='R0lGODlhGAAYAIABAAAAAP///yH5BAEAAAEALAAAAAAYABgAAAI0jI+py+0PAXxATlbtTVlv03lbKE5kSZ3fWY0surxtRH5BduMuqF9eZzsAg7xZcEg0EpebAgA7')
		img2 = PhotoImage(format='gif',data='R0lGODlhGAAYAJECAP///wAAAP///wAAACH5BAEAAAIALAAAAAAYABgAAAJOlI+pixEMGwAvwjCrXZhu1mmfRDkjGZpjmGXi1VLtezgPK+e0kE6+H+IAf8QMKFYEwjpJ47H529WgShhVSmpip9Att+j9EsMGm9l2OhUAADs=')
		import time
		img.image = img2
		time.sleep(0.5)
		img.image = img1
		time.sleep(0.5)
		img.image = img2
		
f = Frame(root)
f.pack()
Button(f,text='change img',command=lambda:test(0)).pack(side=LEFT)
Button(f,text='Colors',command=lambda:test(1)).pack(side=LEFT)
Button(f,text='BorderStyle',command=lambda:test(2)).pack(side=LEFT)
Button(f,text='BorderWidth',command=lambda:test(3)).pack(side=LEFT)
Button(f,text='width/hieght',command=lambda:test(4)).pack(side=LEFT)
	
Button(f,text='anchor',command=lambda:test(5)).pack(side=LEFT)
Button(f,text='use as status',command=lambda:test(10)).pack(side=LEFT)

f.mainloop()
